package com.myproject.thread.interrupt;

import java.util.concurrent.locks.LockSupport;

public class MyThread1 implements Runnable {

    @Override
    public void run() {
        LockSupport.park(this);
        /*try {
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException e) {
            //e.printStackTrace();
        }*/
        //System.out.println(Thread.currentThread().getName()+" interrput "+Thread.currentThread().isInterrupted());
        System.out.println(Thread.currentThread().getName()+" interrput "+Thread.interrupted());

    }

    public static void main(String[] args) {

        Thread thread = new Thread(new MyThread1());
        thread.start();

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        thread.interrupt();

        /*for (int i = 0; i < 3; i++) {
            thread.interrupt();
        }*/

    }
}
